// Created by Roman Novitsky on 02.06.2009


#region Imported Namespaces


using System.Collections.Generic;
using System.Windows.Input;


#endregion


namespace WtfManager.UIManager.Commands
{
  public class NavigateUpCommandHandler: OpenCommandHandlerBase
  {
    #region Properties/Indexers


    public override ICommand Command
    {
      get
      {
        return WtfNavigationCommands.NavigateUp;
      }
    }

    public override string Description
    {
      get
      {
        return "Handles 'Navigate Up' command.";
      }
    }

    public override string Name
    {
      get
      {
        return "Navigate Up Command Handler";
      }
    }


    #endregion


    #region Methods


    protected override bool CanExecute(List<object> itemsToOpen)
    {
      object currentDocumentItem = GetCurrentDocumentItem();
      object parentItem = GetParentItem(currentDocumentItem);

      return parentItem != null && CanOpenInCurrentTab(parentItem);
    }


    protected override void Execute(List<object> itemsToOpen)
    {
      object currentDocumentItem = GetCurrentDocumentItem();
      object parentItem = GetParentItem(currentDocumentItem);

      OpenInCurrentTab(parentItem);
    }


    #endregion
  }
}